import {defineStore} from 'pinia'

export const useCartStore = defineStore('cart', {
	state() {
		return {
			products: [], // 要结算的商品信息
			total: undefined, // 总价格
			url: undefined
		}
	},
	actions: {
		setProducts(arr, total) {
			this.products = arr
			this.total = total
		},
		setUrl(url) {
			this.url = url
		}
	},
	persist: {
		enabled: true
	}
})